<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>文章管理-新闻信息管理系统</title>
    <link rel="stylesheet" href="view/assets/css/bootstrap.min.css">
    <script src="view/assets/js/html5shiv.min.js"></script>
    <script src="view/assets/js/respond.min.js"></script>
</head>
<style>
    *{
        margin: 0;
        padding: 0;
    }
</style>
<body>
<nav class="navbar navbar-inverse navbar-fixed-top">
    <div class="container">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" style="margin: auto;" href="index.php">新闻信息管理系统</a>
            <a class="navbar-brand" style="margin: auto; font-size: 15px;" href="admin.php">首页</a>
            <a class="navbar-brand" style="margin: auto; font-size: 15px;" href="artlist.php">文章管理</a>
            <a class="navbar-brand" style="margin: auto; font-size: 15px;" href="catlist.php">分类管理</a>
            <a class="navbar-brand" style="margin: auto;font-size: 15px;" href="commlist.php">评论管理</a>
            <a class="navbar-brand" style="margin: auto; font-size: 15px;" href="role.php">权限管理</a>
            <a class="navbar-brand" style="margin: auto;font-size: 15px;" href="about.php">关于</a>
        </div>
        <!--跳转后台登录按钮-->
        <div id="navbar" class="navbar-collapse collapse">
            <form class="navbar-form navbar-right">
                <a type="button" class="btn btn-success" href="logout.php">退出</a>
            </form>
        </div>
    </div>
</nav>
<!--头部-->
<div class="jumbotron text-center">
    <div style="margin: 20px;">
        <p>新闻信息管理系统</p><p>文章管理</p>
    </div>
</div>
<!--主体部分-->
<div class="container">
    <div class="row text-center">
        <div class="col-sm-2">
            <div class="page-header">
                <h1>搜索文章</h1>
            </div>
            <form action="searchart.php" method="post">
                <div class="input-group">
                    <input name="search" id="search" type="text" class="form-control" placeholder="根据文章标题搜索">
                    <span class="input-group-btn">
                    <button class="btn btn-default" type="submit">搜索</button>
                    </span>
                </div>
            </form>
            <div class="page-header">
                <h1>文章分类</h1>
                <div class="panel panel-default">
                    <div class="panel-body">
                        <?php foreach($cats as $c) {?>
                        <a class="btn btn-info" style="margin-top: 5px;" type="button" href="artlist.php?cat_id=<?php echo $c['cat_id']; ?>">
                            <span><?php echo $c['cat_name']; ?></span><span class="badge"><?php echo $c['cat_num'];?></span>
                        </a><br>
                        <?php } ?>
                        <?php if($where != '' or $searchWord != '') {?>
                        <a class="btn btn-info" style="margin-top: 5px;" type="button" href="artlist.php">
                            <span>查看全部</span>
                        </a><br>
                        <?php }?>
                    </div>
                </div>
            </div>
        </div>
        <div class="col-sm-8">
            <div class="page-header">
                <h1>文章列表</h1><a class="label label-info" style="font-size:15px;" href="artadd.php">发布新文章</a>
                <div class="table-responsive" style="margin-top: 5px;">
                    <table class="table table-bordered tab-hover">
                        <thead>
                        <tr>
                            <th>ID</th>
                            <th>日期</th>
                            <th>标题</th>
                            <th>分类</th>
                            <th>评论</th>
                            <th>操作</th>
                        </tr>
                        <tbody>
                        <?php foreach ($arts as $a ) {?>
                        <tr>
                            <td><?php echo $num; ?></td>
                            <td><?php echo date('Y/m/d',$a['pubtime']); ?></td>
                            <td><a href="art.php?art_id=<?php echo $a['art_id'];?>"><?php echo $a['title']; ?></a></td>
                            <td><?php echo $a['cat_name']; ?></td>
                            <td><span><?php echo $a['comm']; ?></span></td>
                            <td>
                                <a href="artedit.php?art_id=<?php echo $a['art_id']; ?>">编辑</a>|
                                <a href="artdel.php?art_id=<?php echo $a['art_id'];?>&cat_name=<?php echo $a['cat_name'];?>" onclick="return confirm('是否删除该文章？')">删除</a>
                            </td>
                        </tr>
                        <?php $num = $num +1 ;} ?>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>
<!--页尾-->
<div class="jumbotron text-center" style="margin-bottom:0">
    <p>Copyright © 2020-2021 用于数据库实践</p>
</div>
<script src="view/assets/js/jquery.min.js"></script>
<script src="view/assets/js/bootstrap.min.js"></script>
</body>
</html>

